package com.bootdo.wxnotify;

import com.bootdo.lvyou_specialty.domain.LvyouSpecialtyOrderContent;

import java.util.concurrent.CopyOnWriteArrayList;

/**
 * 订单保存事件 event
  * @author 郝江波
  * @date 2019/9/7 16:52
  */
public class OrderSaveEventSubject {
   private static CopyOnWriteArrayList<WxEventObserver> wxEventObservers  = new CopyOnWriteArrayList();
   public static void  putOrderEvent(LvyouSpecialtyOrderContent lvyouSpecialtyOrderContent){
       notifyAllElements(lvyouSpecialtyOrderContent);
   }
   public void attach(WxEventObserver observer){
       wxEventObservers.add(observer);
   }
   private  static void  notifyAllElements(LvyouSpecialtyOrderContent lvyouSpecialtyOrderContent){
       for(WxEventObserver item : wxEventObservers){
           item.notify(lvyouSpecialtyOrderContent);
       }
   }
}
